home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / content / nsIEventStateManager.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  7KB  |  165 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. #ifndef nsIEventStateManager_h__
  39. #define nsIEventStateManager_h__
  40.  
  41. #include "nsEvent.h"
  42. #include "nsISupports.h"
  43. #include "nsVoidArray.h"
  44.  
  45. class nsIContent;
  46. class nsPresContext;
  47. class nsIDOMEvent;
  48. class nsIFrame;
  49. class nsIView;
  50. class nsIWidget;
  51. class imgIContainer;
  52.  
  53. /*
  54.  * Event state manager interface.
  55.  */
  56. // 2270e188-6743-441e-b6e1-af83f1047a53
  57. #define NS_IEVENTSTATEMANAGER_IID \
  58. { 0x2270e188, 0x6743, 0x441e, \
  59.   { 0xb6, 0xe1, 0xaf, 0x83, 0xf1, 0x04, 0x7a, 0x53 } }
  60.  
  61.  
  62. #define NS_EVENT_NEEDS_FRAME(event) (!NS_IS_FOCUS_EVENT(event))
  63.  
  64. class nsIEventStateManager : public nsISupports {
  65.  
  66. public:
  67.   enum EFocusedWithType {
  68.     eEventFocusedByUnknown,     // focus gained via unknown method
  69.     eEventFocusedByMouse,       // focus gained via mouse
  70.     eEventFocusedByKey,         // focus gained via key press (like tab)
  71.     eEventFocusedByContextMenu, // focus gained via context menu
  72.     eEventFocusedByApplication  // focus gained via Application (like script)
  73.   };
  74.  
  75.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IEVENTSTATEMANAGER_IID)
  76.  
  77.   NS_IMETHOD Init() = 0;
  78.  
  79.   NS_IMETHOD PreHandleEvent(nsPresContext* aPresContext, 
  80.                             nsEvent *aEvent, 
  81.                             nsIFrame* aTargetFrame,
  82.                             nsEventStatus* aStatus,
  83.                             nsIView* aView) = 0;
  84.  
  85.   NS_IMETHOD PostHandleEvent(nsPresContext* aPresContext, 
  86.                              nsEvent *aEvent, 
  87.                              nsIFrame* aTargetFrame,
  88.                              nsEventStatus* aStatus,
  89.                              nsIView* aView) = 0;
  90.  
  91.   NS_IMETHOD SetPresContext(nsPresContext* aPresContext) = 0;
  92.   NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame) = 0;
  93.  
  94.   NS_IMETHOD GetEventTarget(nsIFrame **aFrame) = 0;
  95.   NS_IMETHOD GetEventTargetContent(nsEvent* aEvent, nsIContent** aContent) = 0;
  96.   NS_IMETHOD GetEventRelatedContent(nsIContent** aContent) = 0;
  97.  
  98.   NS_IMETHOD GetContentState(nsIContent *aContent, PRInt32& aState) = 0;
  99.   NS_IMETHOD SetContentState(nsIContent *aContent, PRInt32 aState) = 0;
  100.  
  101.   NS_IMETHOD GetFocusedContent(nsIContent **aContent) = 0;
  102.   NS_IMETHOD SetFocusedContent(nsIContent* aContent) = 0;
  103.  
  104.   // Get the previously-focused content node for this document
  105.   NS_IMETHOD GetLastFocusedContent(nsIContent **aContent) = 0;
  106.  
  107.   NS_IMETHOD GetFocusedFrame(nsIFrame **aFrame) = 0;
  108.  
  109.   NS_IMETHOD ContentRemoved(nsIContent* aContent) = 0;
  110.   NS_IMETHOD EventStatusOK(nsGUIEvent* aEvent, PRBool *aOK) = 0;
  111.  
  112.   // Return whether browse with caret is enabled or not
  113.   virtual PRBool GetBrowseWithCaret() = 0;
  114.  
  115.   // This is called after find text or when a cursor movement key is pressed
  116.   // If aCanFocusDoc == PR_TRUE, the current document will be focused if caret is not on a focusable element
  117.   NS_IMETHOD MoveFocusToCaret(PRBool aCanFocusDoc, PRBool *aIsSelectionWithFocus) = 0;
  118.   NS_IMETHOD MoveCaretToFocus() = 0;
  119.  
  120.   // Set focus on any element that can receive focus, or on document via aFocusContent == nsnull
  121.   // Must supply method that focus is being set with
  122.   NS_IMETHOD ChangeFocusWith(nsIContent *aFocusContent, EFocusedWithType aFocusedWith) = 0;
  123.  
  124.   // This is an experiment and may be temporary
  125.   NS_IMETHOD ConsumeFocusEvents(PRBool aDoConsume) = 0;
  126.  
  127.   // Access Key Registration
  128.   NS_IMETHOD RegisterAccessKey(nsIContent* aContent, PRUint32 aKey) = 0;
  129.   NS_IMETHOD UnregisterAccessKey(nsIContent* aContent, PRUint32 aKey) = 0;
  130.  
  131.   NS_IMETHOD SetCursor(PRInt32 aCursor, imgIContainer* aContainer,
  132.                        PRBool aHaveHotspot, float aHotspotX, float aHotspotY,
  133.                        nsIWidget* aWidget, PRBool aLockCursor) = 0;
  134.  
  135.   //Method for centralized distribution of new DOM events
  136.   NS_IMETHOD DispatchNewEvent(nsISupports* aTarget, nsIDOMEvent* aEvent, PRBool* aDefaultActionEnabled) = 0;
  137.  
  138.   // Method for moving the focus forward/back.
  139.   NS_IMETHOD ShiftFocus(PRBool aDirection, nsIContent* aStart)=0;
  140. };
  141.  
  142. #define NS_EVENT_STATE_ACTIVE        0x00000001 // mouse is down on content
  143. #define NS_EVENT_STATE_FOCUS         0x00000002 // content has focus
  144. #define NS_EVENT_STATE_HOVER         0x00000004 // mouse is hovering over content
  145. #define NS_EVENT_STATE_DRAGOVER      0x00000008 // drag  is hovering over content
  146. #define NS_EVENT_STATE_URLTARGET     0x00000010 // content is URL's target (ref)
  147.  
  148. // The following states are used only for ContentStatesChanged
  149. // CSS 3 Selectors
  150. #define NS_EVENT_STATE_CHECKED       0x00000020
  151. #define NS_EVENT_STATE_ENABLED       0x00000040
  152. #define NS_EVENT_STATE_DISABLED      0x00000080
  153. // CSS 3 UI
  154. #define NS_EVENT_STATE_REQUIRED      0x00000100
  155. #define NS_EVENT_STATE_OPTIONAL      0x00000200
  156. #define NS_EVENT_STATE_VISITED       0x00000400
  157. #define NS_EVENT_STATE_VALID         0x00000800
  158. #define NS_EVENT_STATE_INVALID       0x00001000
  159. #define NS_EVENT_STATE_INRANGE       0x00002000
  160. #define NS_EVENT_STATE_OUTOFRANGE    0x00004000
  161. #define NS_EVENT_STATE_MOZ_READONLY  0x00008000
  162. #define NS_EVENT_STATE_MOZ_READWRITE 0x00010000
  163.  
  164. #endif // nsIEventStateManager_h__
  165.